
const chinaPhoneReg = /^1[3|4|5|7|8][0-9]\d{8}$/
const phoneReg = /^[0-9]{4,20}$/
const emailReg = /^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/
const countryCodeReg = /^[+](\d){1,3}$/
const usernameReg = /^[a-zA-Z0-9]{1,30}$/

export const isChinaPhone = data => {
  return chinaPhoneReg.test(data)
}

export const isPhone = data => {
  return phoneReg.test(data)
}

export const isEmail = data => {
  return emailReg.test(data)
}

export const isCountryCode = data => {
  return countryCodeReg.test(data)
}

export const isUsername = data => {
  return usernameReg.test(data)
}
